package com.tcfvic.client.panels;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.VerticalSplitPanel;
import com.tcfvic.client.JSPDetailsListService;
import com.tcfvic.client.JSPDetailsListServiceAsync;
import com.tcfvic.client.panels.widgets.JSPDetailsInputWidget;
import com.tcfvic.client.panels.widgets.JSPDetailsListWidget;

public class JSPDetailsForm {

	/**
	 * Create a remote service proxy to talk to the server-side CompanyDetails
	 * service.
	 */
	private final JSPDetailsListServiceAsync jspDetailsListService = GWT
			.create(JSPDetailsListService.class);
	private VerticalSplitPanel vSplit = new VerticalSplitPanel();

	public JSPDetailsForm(boolean editing) {
		// Create a Vertical Split Panel
		vSplit = new VerticalSplitPanel();
		vSplit.ensureDebugId("cwVerticalSplitPanel");
		vSplit.setSize("900px", "800px");
		vSplit.setSplitPosition("1%");

		JSPDetailsInputWidget jspDetails = new JSPDetailsInputWidget();
		JSPDetailsListWidget jspDetailsList = null;
		if (editing) {
			jspDetailsList = new JSPDetailsListWidget(
					jspDetailsListService, jspDetails);
			vSplit.setTopWidget(jspDetailsList);
			vSplit.setSplitPosition("40%");
		}
		jspDetails.addJSPDetailsList(jspDetailsList);
		vSplit.setBottomWidget(jspDetails);

	}

	public VerticalSplitPanel getvSplit() {
		return vSplit;
	}
}
